VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3945
ClientLeft = 60
ClientTop = 345
ClientWidth = 6090
LinkTopic = "Form1"
ScaleHeight = 3945
ScaleWidth = 6090
StartUpPosition = 3 'Windows Default
Begin VB.DirListBox Dir1out
Height = 2115
Left = 3240
TabIndex = 5
Top = 1200
Width = 2655
End
Begin VB.DriveListBox Drive1out
Height = 315
Left = 3240
TabIndex = 4
Top = 600
Width = 2655
End
Begin VB.DirListBox Dir1in
Height = 2115
Left = 120
TabIndex = 3
Top = 1200
Width = 2895
End
Begin VB.DriveListBox Drive1in
Height = 315
Left = 120
TabIndex = 2
Top = 600
Width = 2895
End
Begin VB.CommandButton CmdExit
Caption = "E&xit"
Height = 495
Left = 3240
TabIndex = 1
Top = 3360
Width = 1575
End
Begin VB.CommandButton CmdCreate
Caption = "Create HTML"
Height = 495
Left = 1440
TabIndex = 0
Top = 3360
Width = 1575
End
Begin VB.Label Label
Caption = "Output Directory"
Height = 255
Index = 1
Left = 3240
TabIndex = 7
Top = 360
Width = 1215
End
Begin VB.Label Label
Caption = "Input Directory"
Height = 255
Index = 0
Left = 120
TabIndex = 6
Top = 360
Width = 1095
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim filhtml As String
Dim fileout As String
Private Sub CmdCreate_Click()
WriteHTMLListing filhtml & "\", "*.*", fileout & "\index.htm", "HTML List Generator", "Files in " & filhtml
End Sub
Sub WriteHTMLListing(Directory As String, FileExtension As String, ListFilename As String, Appname As String, ListTitle As String)
'Note - when outputting HTML, make sure you replace any " marks with Chr(34) or the tags will be ignored
Dim CurrFile As String 'Used to hold the filenames
Dim FF, FileCount As Integer 'FF - Used to hold Freefile number, FileCount - Used for footer info
FF = FreeFile 'You should know what this means
CurrFile = Dir(Directory & FileExtension) 'Change the DIR directory to Directory Variable
'and show all files of FileExtension (wildcards included)
Open ListFilename For Output As #FF 'Open the output file
Print #FF, ""
Print #FF, ""
Print #FF, "" & ListTitle & "" & vbCrLf & ""
Print #FF, ListTitle & "
"
Do While CurrFile <> "" 'Do until the DIR function returns a null string, indicating no more files
Print #FF, "" & CurrFile & "
" 'Put the filename of the current file in the open file"
FileCount = FileCount + 1 'Increment File counter (for footer so U can remove it if U want)
CurrFile = Dir()
'Print a blank line to seperate the list and the footer, then print
'the footer. The footer here is the number of files in the directory.
' Print #FF, FileCount & " Files" & ""
Close #FF 'Close the output file
End Sub
Private Sub CmdExit_Click()
End Sub
Private Sub Dir1in_Change()
filhtml = Dir1in.Path
End Sub
Private Sub Dir1out_Change()
fileout = Dir1out.Path
End Sub
Private Sub Drive1in_Change()
Dir1in.Path = Drive1in.Drive
End Sub
Private Sub Drive1out_Change()
Dir1out.Path = Drive1out.Drive
End Sub